package com.yjz.demo.router;

import android.os.Bundle;
import android.view.View;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.alibaba.android.arouter.launcher.ARouter;
import com.yjz.demo.R;

/**
 * 作用 : ARouter路由demo
 * 作者 : yjz
 * 时间 : 2024/10/24 14:36
 */
public class RouterDemoActivity extends AppCompatActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_router_demo);
        ARouter.getInstance().inject(this);

        findViewById(R.id.user_info_center).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ARouter.getInstance().build("/login/activity").navigation();
            }
        });
        findViewById(R.id.unknow).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                // 验证错误路由是否能正确导向到错误页
                ARouter.getInstance().build("/unknow/activity").navigation();
            }
        });
    }
}
